<!DOCTYPE html>




<html class="theme-next gemini" lang="zh-Hans">
<head>
  <meta charset="UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"/>
<meta name="theme-color" content="#222">









<meta http-equiv="Cache-Control" content="no-transform" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
















  
  
  <link href="/lib/fancybox/source/jquery.fancybox.css?v=2.1.5" rel="stylesheet" type="text/css" />







<link href="/lib/font-awesome/css/font-awesome.min.css?v=4.6.2" rel="stylesheet" type="text/css" />

<link href="/css/main.css?v=5.1.3" rel="stylesheet" type="text/css" />


  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=5.1.3">


  <link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=5.1.3">


  <link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=5.1.3">


  <link rel="mask-icon" href="/images/logo.svg?v=5.1.3" color="#222">





  <meta name="keywords" content="Curl,Python,Json format,工具使用," />





  <link rel="alternate" href="/atom.xml" title="流水不腐小夏" type="application/atom+xml" />






<meta name="description" content="格式化Curl返回的Json字符   格式化Curl返回的Json字符 Python 格式化 Nodejs 格式化     经常会用到curl调试接口，服务器返回的是json，不过这些json是没有格式化的，不方便阅读。 经过搜索和实验，发现下面2中方式比较方便。 示例： 12curl https://news-at.zhihu.com/api/4/news/latest&amp;#123;&quot;date&quot;:">
<meta name="keywords" content="Curl,Python,Json format,工具使用">
<meta property="og:type" content="article">
<meta property="og:title" content="格式化Curl返回的Json字符">
<meta property="og:url" content="http://mycommons.cn/2017/08/12/curl-fromat-json-response/index.html">
<meta property="og:site_name" content="流水不腐小夏">
<meta property="og:description" content="格式化Curl返回的Json字符   格式化Curl返回的Json字符 Python 格式化 Nodejs 格式化     经常会用到curl调试接口，服务器返回的是json，不过这些json是没有格式化的，不方便阅读。 经过搜索和实验，发现下面2中方式比较方便。 示例： 12curl https://news-at.zhihu.com/api/4/news/latest&amp;#123;&quot;date&quot;:">
<meta property="og:locale" content="zh-Hans">
<meta property="og:updated_time" content="2017-10-25T11:47:41.000Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="格式化Curl返回的Json字符">
<meta name="twitter:description" content="格式化Curl返回的Json字符   格式化Curl返回的Json字符 Python 格式化 Nodejs 格式化     经常会用到curl调试接口，服务器返回的是json，不过这些json是没有格式化的，不方便阅读。 经过搜索和实验，发现下面2中方式比较方便。 示例： 12curl https://news-at.zhihu.com/api/4/news/latest&amp;#123;&quot;date&quot;:">



<script type="text/javascript" id="hexo.configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '5.1.3',
    sidebar: {"position":"left","display":"always","offset":12,"b2t":false,"scrollpercent":false,"onmobile":false},
    fancybox: true,
    tabs: true,
    motion: {"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    duoshuo: {
      userId: '0',
      author: '博主'
    },
    algolia: {
      applicationID: 'GRLHBBCD9E',
      apiKey: '759ab3f5c09b132b3ed4842a44c53c45',
      indexName: 'mycommons',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    }
  };
</script>



  <link rel="canonical" href="http://mycommons.cn/2017/08/12/curl-fromat-json-response/"/>





  <title>格式化Curl返回的Json字符 | 流水不腐小夏</title>
  





  <script type="text/javascript">
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?55458ffca1f60dd283f11b9a7f82b262";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>




</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-Hans">

  
  
    
  

  <div class="container sidebar-position-left page-post-detail">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta ">
    

    <div class="custom-logo-site-title">
      <a href="/"  class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">流水不腐小夏</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
      
        <h1 class="site-subtitle" itemprop="description">http://mycommons.cn</h1>
      
  </div>

  <div class="site-nav-toggle">
    <button>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>

<nav class="site-nav">
  

  
    <ul id="menu" class="menu">
      
        
        <li class="menu-item menu-item-home">
          <a href="/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-home"></i> <br />
            
            首页
          </a>
        </li>
      
        
        <li class="menu-item menu-item-tags">
          <a href="/tags/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-tags"></i> <br />
            
            标签
          </a>
        </li>
      
        
        <li class="menu-item menu-item-categories">
          <a href="/categories/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-th"></i> <br />
            
            分类
          </a>
        </li>
      
        
        <li class="menu-item menu-item-archives">
          <a href="/archives/" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-archive"></i> <br />
            
            归档
          </a>
        </li>
      
        
        <li class="menu-item menu-item-commonweal">
          <a href="/404.html" rel="section">
            
              <i class="menu-item-icon fa fa-fw fa-heartbeat"></i> <br />
            
            公益404
          </a>
        </li>
      

      
        <li class="menu-item menu-item-search">
          
            <a href="javascript:;" class="popup-trigger">
          
            
              <i class="menu-item-icon fa fa-search fa-fw"></i> <br />
            
            搜索
          </a>
        </li>
      
    </ul>
  

  
    <div class="site-search">
      
  
  <div class="algolia-popup popup search-popup">
    <div class="algolia-search">
      <div class="algolia-search-input-icon">
        <i class="fa fa-search"></i>
      </div>
      <div class="algolia-search-input" id="algolia-search-input"></div>
    </div>

    <div class="algolia-results">
      <div id="algolia-stats"></div>
      <div id="algolia-hits"></div>
      <div id="algolia-pagination" class="algolia-pagination"></div>
    </div>

    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>




    </div>
  
</nav>



 </div>
    </header>

    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
          <div id="content" class="content">
            

  <div id="posts" class="posts-expand">
    

  

  
  
  

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="http://mycommons.cn/2017/08/12/curl-fromat-json-response/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="流水不腐小夏">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/avatar.jpeg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="流水不腐小夏">
    </span>

    
      <header class="post-header">

        
        
          <h2 class="post-title" itemprop="name headline">格式化Curl返回的Json字符</h2>
        

        <div class="post-meta">
          <span class="post-time">
            
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              
                <span class="post-meta-item-text">发表于</span>
              
              <time title="创建于" itemprop="dateCreated datePublished" datetime="2017-08-12T18:30:32+08:00">
                2017-08-12
              </time>
            

            

            
          </span>

          
            <span class="post-category" >
            
              <span class="post-meta-divider">|</span>
            
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              
                <span class="post-meta-item-text">分类于</span>
              
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing">
                  <a href="/categories/工具使用/" itemprop="url" rel="index">
                    <span itemprop="name">工具使用</span>
                  </a>
                </span>

                
                
              
            </span>
          

          
            
              <span class="post-comments-count">
                <span class="post-meta-divider">|</span>
                <span class="post-meta-item-icon">
                  <i class="fa fa-comment-o"></i>
                </span>
                <a href="/2017/08/12/curl-fromat-json-response/#comments" itemprop="discussionUrl">
                  <span class="post-comments-count disqus-comment-count"
                        data-disqus-identifier="2017/08/12/curl-fromat-json-response/" itemprop="commentCount"></span>
                </a>
              </span>
            
          

          
          

          
            <span class="post-meta-divider">|</span>
            <span class="page-pv">本文总阅读量
            <span class="busuanzi-value" id="busuanzi_value_page_pv" ></span>次
            </span>
          

          

          

        </div>
      </header>
    

    
    
    
    <div class="post-body" itemprop="articleBody">

      
      

      
        <h1 id="格式化Curl返回的Json字符"><a href="#格式化Curl返回的Json字符" class="headerlink" title="格式化Curl返回的Json字符"></a>格式化Curl返回的Json字符</h1><hr>
<!-- TOC -->
<ul>
<li><a href="#格式化curl返回的json字符">格式化Curl返回的Json字符</a><ul>
<li><a href="#python-格式化">Python 格式化</a></li>
<li><a href="#nodejs-格式化">Nodejs 格式化</a></li>
</ul>
</li>
</ul>
<!-- /TOC -->
<p>经常会用到curl调试接口，服务器返回的是json，不过这些json是没有格式化的，不方便阅读。</p>
<p>经过搜索和实验，发现下面2中方式比较方便。</p>
<p>示例：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div></pre></td><td class="code"><pre><div class="line">curl https://news-at.zhihu.com/api/4/news/latest</div><div class="line">&#123;<span class="string">"date"</span>:<span class="string">"20171014"</span>,<span class="string">"stories"</span>:[&#123;<span class="string">"title"</span>:<span class="string">"这些有故事的 DOTA 职业选手外号（国外篇）"</span>,<span class="string">"ga_prefix"</span>:<span class="string">"101417"</span>,<span class="string">"images"</span>:[<span class="string">"https:\/\/pic3.zhimg.com\/v2-471f6f1170fcb7d491ba54404acaf30a.jpg"</span>],<span class="string">"multipic"</span>:<span class="literal">true</span>,<span class="string">"type"</span>:0,<span class="string">"id"</span>:9651211&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic1.zhimg.com\/v2-16e9abb39a4fb4dd56994c9db9378110.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9649645,<span class="string">"ga_prefix"</span>:<span class="string">"101416"</span>,<span class="string">"title"</span>:<span class="string">"被你的宠物捉弄的的时候，你想过「动物是否会骗人」吗？"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic3.zhimg.com\/v2-5ab5db73049a413a6810677ad3817602.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9651376,<span class="string">"ga_prefix"</span>:<span class="string">"101415"</span>,<span class="string">"title"</span>:<span class="string">"想明白 iPhone X 的人脸识别是怎么工作的，先得了解这道「光」"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic1.zhimg.com\/v2-c20f4551e1725eef3ac7cd502e9ed71c.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9649434,<span class="string">"ga_prefix"</span>:<span class="string">"101414"</span>,<span class="string">"title"</span>:<span class="string">"不靠专利，拿什么保护发明？世博会的数据会告诉你"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic1.zhimg.com\/v2-a0a033debd47042be4554a3450fe9478.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9650760,<span class="string">"ga_prefix"</span>:<span class="string">"101413"</span>,<span class="string">"title"</span>:<span class="string">"回头看这项世界顶级比赛的历史，对它的存在意义愈发迷茫"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic4.zhimg.com\/v2-0df458ee4784b68befc40c03ddf5bc67.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9646702,<span class="string">"ga_prefix"</span>:<span class="string">"101412"</span>,<span class="string">"title"</span>:<span class="string">"大误 · 一次咨询"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic2.zhimg.com\/v2-9d0caf3ba46c60a15826e53ea8473a5d.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9634763,<span class="string">"ga_prefix"</span>:<span class="string">"101411"</span>,<span class="string">"title"</span>:<span class="string">"黄金钩焖五花肉，绵软浓香的口感，其他菜绝对没法比"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic4.zhimg.com\/v2-c4964723821a835fb42a4f70bfa8ce6f.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9650778,<span class="string">"ga_prefix"</span>:<span class="string">"101410"</span>,<span class="string">"title"</span>:<span class="string">"Ta 的一生可以写 20 本书，至于是男是女，已经不重要了"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic1.zhimg.com\/v2-054e30b7cec2624a849af1e358528cd8.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9634507,<span class="string">"ga_prefix"</span>:<span class="string">"101409"</span>,<span class="string">"title"</span>:<span class="string">"中国有哪些不出名，但值得一去的山？"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic4.zhimg.com\/v2-95d371314244ca1ce74bfbd22ba0938f.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9651324,<span class="string">"ga_prefix"</span>:<span class="string">"101408"</span>,<span class="string">"title"</span>:<span class="string">"- 实在想不到怎么出国更炫酷了\r\n- 喏，自己开飞机去"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic2.zhimg.com\/v2-06dd1c008cac334147cd81abf0bfefe1.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9649625,<span class="string">"ga_prefix"</span>:<span class="string">"101407"</span>,<span class="string">"title"</span>:<span class="string">"早起来一份「班尼迪克蛋」，做个逼格满满的早餐网红"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic4.zhimg.com\/v2-b0e9676d36b7fd4b1822ba8cb93bf4f7.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9651424,<span class="string">"ga_prefix"</span>:<span class="string">"101407"</span>,<span class="string">"title"</span>:<span class="string">"丁俊晖：那个满脸青春痘的少年球手，几度大起大落已是而立之年"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic3.zhimg.com\/v2-a065e8278298efb317b13d92084275f6.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9650104,<span class="string">"ga_prefix"</span>:<span class="string">"101407"</span>,<span class="string">"title"</span>:<span class="string">"在你读过的童话中，是不是一对姐妹里坏的那个总是姐姐？"</span>&#125;,&#123;<span class="string">"images"</span>:[<span class="string">"https:\/\/pic3.zhimg.com\/v2-db3702f9cee08897c8f7a174000f0ca2.jpg"</span>],<span class="string">"type"</span>:0,<span class="string">"id"</span>:9651366,<span class="string">"ga_prefix"</span>:<span class="string">"101406"</span>,<span class="string">"title"</span>:<span class="string">"瞎扯 · 如何正确地吐槽"</span>&#125;],<span class="string">"top_stories"</span>:[&#123;<span class="string">"image"</span>:<span class="string">"https:\/\/pic3.zhimg.com\/v2-e5dc45c4698771e7001e1ae1c27ba8b6.jpg"</span>,<span class="string">"type"</span>:0,<span class="string">"id"</span>:9651376,<span class="string">"ga_prefix"</span>:<span class="string">"101415"</span>,<span class="string">"title"</span>:<span class="string">"想明白 iPhone X 的人脸识别是怎么工作的，先得了解这道「光」"</span>&#125;,&#123;<span class="string">"image"</span>:<span class="string">"https:\/\/pic3.zhimg.com\/v2-ce790cb7a633fbc7aa8e2303e3c1ce16.jpg"</span>,<span class="string">"type"</span>:0,<span class="string">"id"</span>:9651424,<span class="string">"ga_prefix"</span>:<span class="string">"101407"</span>,<span class="string">"title"</span>:<span class="string">"丁俊晖：那个满脸青春痘的少年球手，几度大起大落已是而立之年"</span>&#125;,&#123;<span class="string">"image"</span>:<span class="string">"https:\/\/pic2.zhimg.com\/v2-36e6e13f557c2dd29e65d8c23fa9cec5.jpg"</span>,<span class="string">"type"</span>:0,<span class="string">"id"</span>:9634507,<span class="string">"ga_prefix"</span>:<span class="string">"101409"</span>,<span class="string">"title"</span>:<span class="string">"中国有哪些不出名，但值得一去的山？"</span>&#125;,&#123;<span class="string">"image"</span>:<span class="string">"https:\/\/pic4.zhimg.com\/v2-79056fe95d9834f9c8b30957980b0193.jpg"</span>,<span class="string">"type"</span>:0,<span class="string">"id"</span>:9649434,<span class="string">"ga_prefix"</span>:<span class="string">"101414"</span>,<span class="string">"title"</span>:<span class="string">"不靠专利，拿什么保护发明？世博会的数据会告诉你"</span>&#125;,&#123;<span class="string">"image"</span>:<span class="string">"https:\/\/pic4.zhimg.com\/v2-45e71d718938e0a4e292b12e52269a07.jpg"</span>,<span class="string">"type"</span>:0,<span class="string">"id"</span>:9650104,<span class="string">"ga_prefix"</span>:<span class="string">"101407"</span>,<span class="string">"title"</span>:<span class="string">"在你读过的童话中，是不是一对姐妹里坏的那个总是姐姐？"</span>&#125;]&#125;</div></pre></td></tr></table></figure>
<h2 id="Python-格式化"><a href="#Python-格式化" class="headerlink" title="Python 格式化"></a>Python 格式化</h2><p>在curl命令后面添加 <code>| python -m json.tool</code> 即可。</p>
<p>如下所示</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div><div class="line">128</div><div class="line">129</div><div class="line">130</div><div class="line">131</div><div class="line">132</div><div class="line">133</div><div class="line">134</div><div class="line">135</div><div class="line">136</div><div class="line">137</div><div class="line">138</div><div class="line">139</div><div class="line">140</div><div class="line">141</div><div class="line">142</div><div class="line">143</div><div class="line">144</div><div class="line">145</div><div class="line">146</div><div class="line">147</div><div class="line">148</div><div class="line">149</div><div class="line">150</div><div class="line">151</div><div class="line">152</div><div class="line">153</div><div class="line">154</div><div class="line">155</div><div class="line">156</div><div class="line">157</div><div class="line">158</div><div class="line">159</div><div class="line">160</div><div class="line">161</div><div class="line">162</div><div class="line">163</div><div class="line">164</div><div class="line">165</div><div class="line">166</div><div class="line">167</div><div class="line">168</div><div class="line">169</div><div class="line">170</div><div class="line">171</div><div class="line">172</div><div class="line">173</div></pre></td><td class="code"><pre><div class="line">curl https://news-at.zhihu.com/api/4/news/latest | python -m json.tool</div><div class="line">  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current</div><div class="line">                                 Dload  Upload   Total   Spent    Left  Speed</div><div class="line">100  3901  100  3901    0     0  33333      0 --:--:-- --:--:-- --:--:-- 33629</div><div class="line">&#123;</div><div class="line">    <span class="string">"date"</span>: <span class="string">"20171014"</span>,</div><div class="line">    <span class="string">"stories"</span>: [</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101417"</span>,</div><div class="line">            <span class="string">"id"</span>: 9651211,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic3.zhimg.com/v2-471f6f1170fcb7d491ba54404acaf30a.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"multipic"</span>: <span class="literal">true</span>,</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u8fd9\u4e9b\u6709\u6545\u4e8b\u7684 DOTA \u804c\u4e1a\u9009\u624b\u5916\u53f7\uff08\u56fd\u5916\u7bc7\uff09"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101416"</span>,</div><div class="line">            <span class="string">"id"</span>: 9649645,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic1.zhimg.com/v2-16e9abb39a4fb4dd56994c9db9378110.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u88ab\u4f60\u7684\u5ba0\u7269\u6349\u5f04\u7684\u7684\u65f6\u5019\uff0c\u4f60\u60f3\u8fc7\u300c\u52a8\u7269\u662f\u5426\u4f1a\u9a97\u4eba\u300d\u5417\uff1f"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101415"</span>,</div><div class="line">            <span class="string">"id"</span>: 9651376,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic3.zhimg.com/v2-5ab5db73049a413a6810677ad3817602.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u60f3\u660e\u767d iPhone X \u7684\u4eba\u8138\u8bc6\u522b\u662f\u600e\u4e48\u5de5\u4f5c\u7684\uff0c\u5148\u5f97\u4e86\u89e3\u8fd9\u9053\u300c\u5149\u300d"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101414"</span>,</div><div class="line">            <span class="string">"id"</span>: 9649434,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic1.zhimg.com/v2-c20f4551e1725eef3ac7cd502e9ed71c.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u4e0d\u9760\u4e13\u5229\uff0c\u62ff\u4ec0\u4e48\u4fdd\u62a4\u53d1\u660e\uff1f\u4e16\u535a\u4f1a\u7684\u6570\u636e\u4f1a\u544a\u8bc9\u4f60"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101413"</span>,</div><div class="line">            <span class="string">"id"</span>: 9650760,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic1.zhimg.com/v2-a0a033debd47042be4554a3450fe9478.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u56de\u5934\u770b\u8fd9\u9879\u4e16\u754c\u9876\u7ea7\u6bd4\u8d5b\u7684\u5386\u53f2\uff0c\u5bf9\u5b83\u7684\u5b58\u5728\u610f\u4e49\u6108\u53d1\u8ff7\u832b"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101412"</span>,</div><div class="line">            <span class="string">"id"</span>: 9646702,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic4.zhimg.com/v2-0df458ee4784b68befc40c03ddf5bc67.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u5927\u8bef \u00b7 \u4e00\u6b21\u54a8\u8be2"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101411"</span>,</div><div class="line">            <span class="string">"id"</span>: 9634763,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic2.zhimg.com/v2-9d0caf3ba46c60a15826e53ea8473a5d.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u9ec4\u91d1\u94a9\u7116\u4e94\u82b1\u8089\uff0c\u7ef5\u8f6f\u6d53\u9999\u7684\u53e3\u611f\uff0c\u5176\u4ed6\u83dc\u7edd\u5bf9\u6ca1\u6cd5\u6bd4"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101410"</span>,</div><div class="line">            <span class="string">"id"</span>: 9650778,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic4.zhimg.com/v2-c4964723821a835fb42a4f70bfa8ce6f.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"Ta \u7684\u4e00\u751f\u53ef\u4ee5\u5199 20 \u672c\u4e66\uff0c\u81f3\u4e8e\u662f\u7537\u662f\u5973\uff0c\u5df2\u7ecf\u4e0d\u91cd\u8981\u4e86"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101409"</span>,</div><div class="line">            <span class="string">"id"</span>: 9634507,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic1.zhimg.com/v2-054e30b7cec2624a849af1e358528cd8.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u4e2d\u56fd\u6709\u54ea\u4e9b\u4e0d\u51fa\u540d\uff0c\u4f46\u503c\u5f97\u4e00\u53bb\u7684\u5c71\uff1f"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101408"</span>,</div><div class="line">            <span class="string">"id"</span>: 9651324,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic4.zhimg.com/v2-95d371314244ca1ce74bfbd22ba0938f.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"- \u5b9e\u5728\u60f3\u4e0d\u5230\u600e\u4e48\u51fa\u56fd\u66f4\u70ab\u9177\u4e86\r\n- \u558f\uff0c\u81ea\u5df1\u5f00\u98de\u673a\u53bb"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">            <span class="string">"id"</span>: 9649625,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic2.zhimg.com/v2-06dd1c008cac334147cd81abf0bfefe1.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u65e9\u8d77\u6765\u4e00\u4efd\u300c\u73ed\u5c3c\u8fea\u514b\u86cb\u300d\uff0c\u505a\u4e2a\u903c\u683c\u6ee1\u6ee1\u7684\u65e9\u9910\u7f51\u7ea2"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">            <span class="string">"id"</span>: 9651424,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic4.zhimg.com/v2-b0e9676d36b7fd4b1822ba8cb93bf4f7.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u4e01\u4fca\u6656\uff1a\u90a3\u4e2a\u6ee1\u8138\u9752\u6625\u75d8\u7684\u5c11\u5e74\u7403\u624b\uff0c\u51e0\u5ea6\u5927\u8d77\u5927\u843d\u5df2\u662f\u800c\u7acb\u4e4b\u5e74"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">            <span class="string">"id"</span>: 9650104,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic3.zhimg.com/v2-a065e8278298efb317b13d92084275f6.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u5728\u4f60\u8bfb\u8fc7\u7684\u7ae5\u8bdd\u4e2d\uff0c\u662f\u4e0d\u662f\u4e00\u5bf9\u59d0\u59b9\u91cc\u574f\u7684\u90a3\u4e2a\u603b\u662f\u59d0\u59d0\uff1f"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101406"</span>,</div><div class="line">            <span class="string">"id"</span>: 9651366,</div><div class="line">            <span class="string">"images"</span>: [</div><div class="line">                <span class="string">"https://pic3.zhimg.com/v2-db3702f9cee08897c8f7a174000f0ca2.jpg"</span></div><div class="line">            ],</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u778e\u626f \u00b7 \u5982\u4f55\u6b63\u786e\u5730\u5410\u69fd"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;</div><div class="line">    ],</div><div class="line">    <span class="string">"top_stories"</span>: [</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101415"</span>,</div><div class="line">            <span class="string">"id"</span>: 9651376,</div><div class="line">            <span class="string">"image"</span>: <span class="string">"https://pic3.zhimg.com/v2-e5dc45c4698771e7001e1ae1c27ba8b6.jpg"</span>,</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u60f3\u660e\u767d iPhone X \u7684\u4eba\u8138\u8bc6\u522b\u662f\u600e\u4e48\u5de5\u4f5c\u7684\uff0c\u5148\u5f97\u4e86\u89e3\u8fd9\u9053\u300c\u5149\u300d"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">            <span class="string">"id"</span>: 9651424,</div><div class="line">            <span class="string">"image"</span>: <span class="string">"https://pic3.zhimg.com/v2-ce790cb7a633fbc7aa8e2303e3c1ce16.jpg"</span>,</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u4e01\u4fca\u6656\uff1a\u90a3\u4e2a\u6ee1\u8138\u9752\u6625\u75d8\u7684\u5c11\u5e74\u7403\u624b\uff0c\u51e0\u5ea6\u5927\u8d77\u5927\u843d\u5df2\u662f\u800c\u7acb\u4e4b\u5e74"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101409"</span>,</div><div class="line">            <span class="string">"id"</span>: 9634507,</div><div class="line">            <span class="string">"image"</span>: <span class="string">"https://pic2.zhimg.com/v2-36e6e13f557c2dd29e65d8c23fa9cec5.jpg"</span>,</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u4e2d\u56fd\u6709\u54ea\u4e9b\u4e0d\u51fa\u540d\uff0c\u4f46\u503c\u5f97\u4e00\u53bb\u7684\u5c71\uff1f"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101414"</span>,</div><div class="line">            <span class="string">"id"</span>: 9649434,</div><div class="line">            <span class="string">"image"</span>: <span class="string">"https://pic4.zhimg.com/v2-79056fe95d9834f9c8b30957980b0193.jpg"</span>,</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u4e0d\u9760\u4e13\u5229\uff0c\u62ff\u4ec0\u4e48\u4fdd\u62a4\u53d1\u660e\uff1f\u4e16\u535a\u4f1a\u7684\u6570\u636e\u4f1a\u544a\u8bc9\u4f60"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;,</div><div class="line">        &#123;</div><div class="line">            <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">            <span class="string">"id"</span>: 9650104,</div><div class="line">            <span class="string">"image"</span>: <span class="string">"https://pic4.zhimg.com/v2-45e71d718938e0a4e292b12e52269a07.jpg"</span>,</div><div class="line">            <span class="string">"title"</span>: <span class="string">"\u5728\u4f60\u8bfb\u8fc7\u7684\u7ae5\u8bdd\u4e2d\uff0c\u662f\u4e0d\u662f\u4e00\u5bf9\u59d0\u59b9\u91cc\u574f\u7684\u90a3\u4e2a\u603b\u662f\u59d0\u59d0\uff1f"</span>,</div><div class="line">            <span class="string">"type"</span>: 0</div><div class="line">        &#125;</div><div class="line">    ]</div><div class="line">&#125;</div></pre></td></tr></table></figure>
<p>如果不想显示curl的统计信息，可以参考这篇<a href="http://www.jianshu.com/p/7e696e1b14d3" target="_blank" rel="external">文章</a>，添加 <code>-s</code>参数即可。</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">curl https://news-at.zhihu.com/api/4/news/latest  -s | python -m json.tool</div></pre></td></tr></table></figure>
<h2 id="Nodejs-格式化"><a href="#Nodejs-格式化" class="headerlink" title="Nodejs 格式化"></a>Nodejs 格式化</h2><p>用nvm安装一个json库，这里是库的<a href="https://www.npmjs.com/package/json" target="_blank" rel="external">地址</a> 文档。</p>
<p>安装<code>json</code>命令</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div></pre></td><td class="code"><pre><div class="line">npm install -g json</div></pre></td></tr></table></figure>
<p>在curl命令后面添加 <code>| json</code> 即可。</p>
<p>如下所示：</p>
<figure class="highlight bash"><table><tr><td class="gutter"><pre><div class="line">1</div><div class="line">2</div><div class="line">3</div><div class="line">4</div><div class="line">5</div><div class="line">6</div><div class="line">7</div><div class="line">8</div><div class="line">9</div><div class="line">10</div><div class="line">11</div><div class="line">12</div><div class="line">13</div><div class="line">14</div><div class="line">15</div><div class="line">16</div><div class="line">17</div><div class="line">18</div><div class="line">19</div><div class="line">20</div><div class="line">21</div><div class="line">22</div><div class="line">23</div><div class="line">24</div><div class="line">25</div><div class="line">26</div><div class="line">27</div><div class="line">28</div><div class="line">29</div><div class="line">30</div><div class="line">31</div><div class="line">32</div><div class="line">33</div><div class="line">34</div><div class="line">35</div><div class="line">36</div><div class="line">37</div><div class="line">38</div><div class="line">39</div><div class="line">40</div><div class="line">41</div><div class="line">42</div><div class="line">43</div><div class="line">44</div><div class="line">45</div><div class="line">46</div><div class="line">47</div><div class="line">48</div><div class="line">49</div><div class="line">50</div><div class="line">51</div><div class="line">52</div><div class="line">53</div><div class="line">54</div><div class="line">55</div><div class="line">56</div><div class="line">57</div><div class="line">58</div><div class="line">59</div><div class="line">60</div><div class="line">61</div><div class="line">62</div><div class="line">63</div><div class="line">64</div><div class="line">65</div><div class="line">66</div><div class="line">67</div><div class="line">68</div><div class="line">69</div><div class="line">70</div><div class="line">71</div><div class="line">72</div><div class="line">73</div><div class="line">74</div><div class="line">75</div><div class="line">76</div><div class="line">77</div><div class="line">78</div><div class="line">79</div><div class="line">80</div><div class="line">81</div><div class="line">82</div><div class="line">83</div><div class="line">84</div><div class="line">85</div><div class="line">86</div><div class="line">87</div><div class="line">88</div><div class="line">89</div><div class="line">90</div><div class="line">91</div><div class="line">92</div><div class="line">93</div><div class="line">94</div><div class="line">95</div><div class="line">96</div><div class="line">97</div><div class="line">98</div><div class="line">99</div><div class="line">100</div><div class="line">101</div><div class="line">102</div><div class="line">103</div><div class="line">104</div><div class="line">105</div><div class="line">106</div><div class="line">107</div><div class="line">108</div><div class="line">109</div><div class="line">110</div><div class="line">111</div><div class="line">112</div><div class="line">113</div><div class="line">114</div><div class="line">115</div><div class="line">116</div><div class="line">117</div><div class="line">118</div><div class="line">119</div><div class="line">120</div><div class="line">121</div><div class="line">122</div><div class="line">123</div><div class="line">124</div><div class="line">125</div><div class="line">126</div><div class="line">127</div><div class="line">128</div><div class="line">129</div><div class="line">130</div><div class="line">131</div><div class="line">132</div><div class="line">133</div><div class="line">134</div><div class="line">135</div><div class="line">136</div><div class="line">137</div><div class="line">138</div><div class="line">139</div><div class="line">140</div><div class="line">141</div><div class="line">142</div><div class="line">143</div><div class="line">144</div><div class="line">145</div><div class="line">146</div><div class="line">147</div><div class="line">148</div><div class="line">149</div><div class="line">150</div><div class="line">151</div><div class="line">152</div><div class="line">153</div><div class="line">154</div><div class="line">155</div><div class="line">156</div><div class="line">157</div><div class="line">158</div><div class="line">159</div><div class="line">160</div><div class="line">161</div><div class="line">162</div><div class="line">163</div><div class="line">164</div><div class="line">165</div><div class="line">166</div><div class="line">167</div><div class="line">168</div><div class="line">169</div><div class="line">170</div></pre></td><td class="code"><pre><div class="line">curl https://news-at.zhihu.com/api/4/news/latest -s | json</div><div class="line">&#123;</div><div class="line">  <span class="string">"date"</span>: <span class="string">"20171014"</span>,</div><div class="line">  <span class="string">"stories"</span>: [</div><div class="line">    &#123;</div><div class="line">      <span class="string">"title"</span>: <span class="string">"这些有故事的 DOTA 职业选手外号（国外篇）"</span>,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101417"</span>,</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic3.zhimg.com/v2-471f6f1170fcb7d491ba54404acaf30a.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"multipic"</span>: <span class="literal">true</span>,</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9651211</div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic1.zhimg.com/v2-16e9abb39a4fb4dd56994c9db9378110.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9649645,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101416"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"被你的宠物捉弄的的时候，你想过「动物是否会骗人」吗？"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic3.zhimg.com/v2-5ab5db73049a413a6810677ad3817602.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9651376,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101415"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"想明白 iPhone X 的人脸识别是怎么工作的，先得了解这道「光」"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic1.zhimg.com/v2-c20f4551e1725eef3ac7cd502e9ed71c.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9649434,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101414"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"不靠专利，拿什么保护发明？世博会的数据会告诉你"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic1.zhimg.com/v2-a0a033debd47042be4554a3450fe9478.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9650760,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101413"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"回头看这项世界顶级比赛的历史，对它的存在意义愈发迷茫"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic4.zhimg.com/v2-0df458ee4784b68befc40c03ddf5bc67.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9646702,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101412"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"大误 · 一次咨询"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic2.zhimg.com/v2-9d0caf3ba46c60a15826e53ea8473a5d.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9634763,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101411"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"黄金钩焖五花肉，绵软浓香的口感，其他菜绝对没法比"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic4.zhimg.com/v2-c4964723821a835fb42a4f70bfa8ce6f.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9650778,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101410"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"Ta 的一生可以写 20 本书，至于是男是女，已经不重要了"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic1.zhimg.com/v2-054e30b7cec2624a849af1e358528cd8.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9634507,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101409"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"中国有哪些不出名，但值得一去的山？"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic4.zhimg.com/v2-95d371314244ca1ce74bfbd22ba0938f.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9651324,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101408"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"- 实在想不到怎么出国更炫酷了\r\n- 喏，自己开飞机去"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic2.zhimg.com/v2-06dd1c008cac334147cd81abf0bfefe1.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9649625,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"早起来一份「班尼迪克蛋」，做个逼格满满的早餐网红"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic4.zhimg.com/v2-b0e9676d36b7fd4b1822ba8cb93bf4f7.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9651424,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"丁俊晖：那个满脸青春痘的少年球手，几度大起大落已是而立之年"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic3.zhimg.com/v2-a065e8278298efb317b13d92084275f6.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9650104,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"在你读过的童话中，是不是一对姐妹里坏的那个总是姐姐？"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"images"</span>: [</div><div class="line">        <span class="string">"https://pic3.zhimg.com/v2-db3702f9cee08897c8f7a174000f0ca2.jpg"</span></div><div class="line">      ],</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9651366,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101406"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"瞎扯 · 如何正确地吐槽"</span></div><div class="line">    &#125;</div><div class="line">  ],</div><div class="line">  <span class="string">"top_stories"</span>: [</div><div class="line">    &#123;</div><div class="line">      <span class="string">"image"</span>: <span class="string">"https://pic3.zhimg.com/v2-e5dc45c4698771e7001e1ae1c27ba8b6.jpg"</span>,</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9651376,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101415"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"想明白 iPhone X 的人脸识别是怎么工作的，先得了解这道「光」"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"image"</span>: <span class="string">"https://pic3.zhimg.com/v2-ce790cb7a633fbc7aa8e2303e3c1ce16.jpg"</span>,</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9651424,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"丁俊晖：那个满脸青春痘的少年球手，几度大起大落已是而立之年"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"image"</span>: <span class="string">"https://pic2.zhimg.com/v2-36e6e13f557c2dd29e65d8c23fa9cec5.jpg"</span>,</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9634507,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101409"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"中国有哪些不出名，但值得一去的山？"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"image"</span>: <span class="string">"https://pic4.zhimg.com/v2-79056fe95d9834f9c8b30957980b0193.jpg"</span>,</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9649434,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101414"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"不靠专利，拿什么保护发明？世博会的数据会告诉你"</span></div><div class="line">    &#125;,</div><div class="line">    &#123;</div><div class="line">      <span class="string">"image"</span>: <span class="string">"https://pic4.zhimg.com/v2-45e71d718938e0a4e292b12e52269a07.jpg"</span>,</div><div class="line">      <span class="string">"type"</span>: 0,</div><div class="line">      <span class="string">"id"</span>: 9650104,</div><div class="line">      <span class="string">"ga_prefix"</span>: <span class="string">"101407"</span>,</div><div class="line">      <span class="string">"title"</span>: <span class="string">"在你读过的童话中，是不是一对姐妹里坏的那个总是姐姐？"</span></div><div class="line">    &#125;</div><div class="line">  ]</div><div class="line">&#125;</div></pre></td></tr></table></figure>
      
    </div>
    
    
    

    

    
      <div>
        <div style="padding: 10px 0; margin: 20px auto; width: 90%; text-align: center;">
  <div>坚持原创技术分享，您的支持将鼓励我继续创作！</div>
  <button id="rewardButton" disable="enable" onclick="var qr = document.getElementById('QR'); if (qr.style.display === 'none') {qr.style.display='block';} else {qr.style.display='none'}">
    <span>打赏</span>
  </button>
  <div id="QR" style="display: none;">

    
      <div id="wechat" style="display: inline-block">
        <img id="wechat_qr" src="/images/wechat_pay.jpeg" alt="流水不腐小夏 微信支付"/>
        <p>微信支付</p>
      </div>
    

    
      <div id="alipay" style="display: inline-block">
        <img id="alipay_qr" src="/images/alipay.jpeg" alt="流水不腐小夏 支付宝"/>
        <p>支付宝</p>
      </div>
    

    

  </div>
</div>

      </div>
    

    

    <footer class="post-footer">
      
        <div class="post-tags">
          
            <a href="/tags/Curl/" rel="tag"># Curl</a>
          
            <a href="/tags/Python/" rel="tag"># Python</a>
          
            <a href="/tags/Json-format/" rel="tag"># Json format</a>
          
            <a href="/tags/工具使用/" rel="tag"># 工具使用</a>
          
        </div>
      

      
      
      

      
        <div class="post-nav">
          <div class="post-nav-next post-nav-item">
            
              <a href="/2017/07/29/WaterMark/" rel="next" title="自己写个小工具——图片水印生成器">
                <i class="fa fa-chevron-left"></i> 自己写个小工具——图片水印生成器
              </a>
            
          </div>

          <span class="post-nav-divider"></span>

          <div class="post-nav-prev post-nav-item">
            
              <a href="/2017/09/15/Android-Architecture-Components/" rel="prev" title="浅谈Android Architecture Components">
                浅谈Android Architecture Components <i class="fa fa-chevron-right"></i>
              </a>
            
          </div>
        </div>
      

      
      
    </footer>
  </div>
  
  
  
  </article>



    <div class="post-spread">
      
    </div>
  </div>


          </div>
          


          

  
    <div class="comments" id="comments">
      <div id="disqus_thread">
        <noscript>
          Please enable JavaScript to view the
          <a href="https://disqus.com/?ref_noscript">comments powered by Disqus.</a>
        </noscript>
      </div>
    </div>

  



        </div>
        
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    
    <div class="sidebar-inner">

      

      
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <section class="site-overview-wrap sidebar-panel">
        <div class="site-overview">
          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
            
              <img class="site-author-image" itemprop="image"
                src="/images/avatar.jpeg"
                alt="流水不腐小夏" />
            
              <p class="site-author-name" itemprop="name">流水不腐小夏</p>
              <p class="site-description motion-element" itemprop="description"></p>
          </div>

          <nav class="site-state motion-element">

            
              <div class="site-state-item site-state-posts">
              
                <a href="/archives/">
              
                  <span class="site-state-item-count">31</span>
                  <span class="site-state-item-name">日志</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-categories">
                <a href="/categories/index.html">
                  <span class="site-state-item-count">10</span>
                  <span class="site-state-item-name">分类</span>
                </a>
              </div>
            

            
              
              
              <div class="site-state-item site-state-tags">
                <a href="/tags/index.html">
                  <span class="site-state-item-count">55</span>
                  <span class="site-state-item-name">标签</span>
                </a>
              </div>
            

          </nav>

          
            <div class="feed-link motion-element">
              <a href="/atom.xml" rel="alternate">
                <i class="fa fa-rss"></i>
                RSS
              </a>
            </div>
          

          <div class="links-of-author motion-element">
            
              
                <span class="links-of-author-item">
                  <a href="https://github.com/LiushuiXiaoxia" target="_blank" title="GitHub">
                    
                      <i class="fa fa-fw fa-GitHub"></i>GitHub</a>
                </span>
              
                <span class="links-of-author-item">
                  <a href="http://www.jianshu.com/u/58771f980bac" target="_blank" title="简书">
                    
                      <i class="fa fa-fw fa-简书"></i>简书</a>
                </span>
              
                <span class="links-of-author-item">
                  <a href="http://blog.csdn.net/guijiaoba" target="_blank" title="CSDN">
                    
                      <i class="fa fa-fw fa-CSDN"></i>CSDN</a>
                </span>
              
            
          </div>

          
          

          
          

          

        </div>
      </section>

      
      <!--noindex-->
        <section class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
              
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#格式化Curl返回的Json字符"><span class="nav-number">1.</span> <span class="nav-text">格式化Curl返回的Json字符</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Python-格式化"><span class="nav-number">1.1.</span> <span class="nav-text">Python 格式化</span></a></li><li class="nav-item nav-level-2"><a class="nav-link" href="#Nodejs-格式化"><span class="nav-number">1.2.</span> <span class="nav-text">Nodejs 格式化</span></a></li></ol></li></ol></div>
            

          </div>
        </section>
      <!--/noindex-->
      

      

    </div>
  </aside>


        
      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; 2015 &mdash; <span itemprop="copyrightYear">2017</span>
  <span class="with-love">
    <i class="fa fa-user"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">流水不腐小夏</span>

  
</div>


  <div class="powered-by">由 <a class="theme-link" target="_blank" href="https://hexo.io">Hexo</a> 强力驱动</div>



  <span class="post-meta-divider">|</span>



  <div class="theme-info">主题 &mdash; <a class="theme-link" target="_blank" href="https://github.com/iissnan/hexo-theme-next">NexT.Gemini</a> v5.1.3</div>




        
<div class="busuanzi-count">
  <script async src="https://dn-lbstatics.qbox.me/busuanzi/2.3/busuanzi.pure.mini.js"></script>

  

  
</div>








        
      </div>
    </footer>

    
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
        
      </div>
    

    

  </div>

  

<script type="text/javascript">
  if (Object.prototype.toString.call(window.Promise) !== '[object Function]') {
    window.Promise = null;
  }
</script>









  












  
  
    <script type="text/javascript" src="/lib/jquery/index.js?v=2.1.3"></script>
  

  
  
    <script type="text/javascript" src="/lib/fastclick/lib/fastclick.min.js?v=1.0.6"></script>
  

  
  
    <script type="text/javascript" src="/lib/jquery_lazyload/jquery.lazyload.js?v=1.9.7"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
  

  
  
    <script type="text/javascript" src="/lib/fancybox/source/jquery.fancybox.pack.js?v=2.1.5"></script>
  


  


  <script type="text/javascript" src="/js/src/utils.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/motion.js?v=5.1.3"></script>



  
  


  <script type="text/javascript" src="/js/src/affix.js?v=5.1.3"></script>

  <script type="text/javascript" src="/js/src/schemes/pisces.js?v=5.1.3"></script>



  
  <script type="text/javascript" src="/js/src/scrollspy.js?v=5.1.3"></script>
<script type="text/javascript" src="/js/src/post-details.js?v=5.1.3"></script>



  


  <script type="text/javascript" src="/js/src/bootstrap.js?v=5.1.3"></script>



  


  

    
      <script id="dsq-count-scr" src="https://mycommons-cn.disqus.com/count.js" async></script>
    

    
      <script type="text/javascript">
        var disqus_config = function () {
          this.page.url = 'http://mycommons.cn/2017/08/12/curl-fromat-json-response/';
          this.page.identifier = '2017/08/12/curl-fromat-json-response/';
          this.page.title = '格式化Curl返回的Json字符';
        };
        var d = document, s = d.createElement('script');
        s.src = 'https://mycommons-cn.disqus.com/embed.js';
        s.setAttribute('data-timestamp', '' + +new Date());
        (d.head || d.body).appendChild(s);
      </script>
    

  




	





  














  




  
  
  
  <link rel="stylesheet" href="/lib/algolia-instant-search/instantsearch.min.css">

  
  
  <script src="/lib/algolia-instant-search/instantsearch.min.js"></script>
  

  <script src="/js/src/algolia-search.js?v=5.1.3"></script>



  

  

  
  

  
  
    <script type="text/x-mathjax-config">
      MathJax.Hub.Config({
        tex2jax: {
          inlineMath: [ ['$','$'], ["\\(","\\)"]  ],
          processEscapes: true,
          skipTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
        }
      });
    </script>

    <script type="text/x-mathjax-config">
      MathJax.Hub.Queue(function() {
        var all = MathJax.Hub.getAllJax(), i;
        for (i=0; i < all.length; i += 1) {
          all[i].SourceElement().parentNode.className += ' has-jax';
        }
      });
    </script>
    <script type="text/javascript" src="//cdn.bootcss.com/mathjax/2.7.1/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
  


  

  

</body>
</html>
